package xgeo

import (
	"github.com/ctessum/geom"
)

type Point struct {
	Lon float64 // geom.Point.X
	Lat float64 // geom.Point.Y
}

type Polygon struct {
	geom.Polygon
}

// NewPolygon 多边形
// coords [[122.4497337048701, 30.72144341879185], [122.4494159828782, 30.72085554049057], [122.4492771551976, 30.7204183022258], [122.4497337048701, 30.72144341879185]]
func NewPolygon(coords [][]float64) Polygon {
	points := make([]geom.Point, 0)
	for _, v := range coords {
		points = append(points, geom.Point{
			X: v[0],
			Y: v[1],
		})
	}
	return Polygon{[]geom.Path{points}}
}
